<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>111</li>
        <li>222</li>
        <li>333</li>
    </ul>
    <ol id="ol">
        <li>111</li>
        <li>222</li>
        <li>333</li>
    </ol>
    <script>
        /* 
            需求：获取li标签
         */
         const lists = document.getElementsByTagName("li")
           console.log(lists) //HTMLCollection(6)  返回的是一个HTML标签的集合
        //  console.log(lists[0])
        //  console.log(lists[0].innerText)
 

         //需求：遍历整个HTMLCollection把所有的li都打印出来
        //  for(const inner of lists){
        //      console.log(inner.innerText)
        //  }

         const ols = document.getElementById("ol")      //返回对象
         console.log(ols)
         //获取ols这个对象的li标签
         const olis = ols.getElementsByTagName("li")        //返回集合
         console.log(olis)


    </script>
</body>
</html>